package cn.tedu.spring.life;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Component
public class Life {
    /*
    生命周期
    1.实例化
    2.属性赋值
    3，初始化
    4.使用
    5.销毁
     */
    private String meaning;

    public Life() {
        System.out.println("1.无参构造实例化");
    }
    @Value("戒嗔痴，制食色，明是我")
    public void setMeaning(String meaning) {
        this.meaning = meaning;
        System.out.println("2.属性赋值");
    }
    @PostConstruct
    public void init(){
        System.out.println("3.生命周期初始化");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("5。生命周期销毁");
    }
}
